<?
require 'header.php';
?>
<div id="layout">
<?
require 'sidebar.php';
?>
	<div id="main">
	<div id="tips" style="display:none"></div>
	<? if ($a == 'pageadd' || $a == 'pageedit'){?>
	   <form name="form1" action=admin.php?m=page&a=pagesave method=post onSubmit="return checkArticleForm()"><input type="hidden" name="artid" value="<?=$article['artid']?>" />
	   <div class="tb_left">
	  <ul>
	  <li><h3>页面标题</h3></li>
	    <li><input name="title" type="text" value="<?=$article['title']?>" class="text" style="width:560px;" /></li>
		<li><h3>页面内容</h3></li>
		<li>
		<div class="editor">
		<script>
		var editor = editor('content');
		document.write (editor);
		</script>
		<div class="editor_text">
		<textarea name='content' id='content'><?=$article['content']?></textarea><br />
		 </div>
	    </div>
	 	<div class="fixed"></div>
		</li>
		<li style="text-align:right"><div style="float:left;font-size:12px;"><a class="button" style="color:#333" href="javascript:showMore('artadd');">附件选项 »</a></div>
		<input class="submit" type="submit" value=" 发布单页 "></li>
		</ul>
		<div class="fixed"></div>
		</div>
	  <div class="tb_right">
	  <ul>
	    <li><h3>自定义链接</h3></li>
		<li><input type="text" class="text" name="htmlurl" value="<?=$article['htmlurl']?>" style="width:150px;"></li>
		</ul>
		<div class="fixed"></div>
		</div>
	<div class="tb_more" id="artadd" style="display:none">
	<ul>
	<div id="msgList">
		<?php foreach($attachment as $attach) {?>
		<dl id="attach_<?=$attach['id']?>"><dt><?=$attach['truefilename']?></dt><dd><a href="javascript:addAttachToEditor('<?=$attach['value']?>')">插入</a> , <a href="javascript:delAttach('<?=$attach['id']?>')">删除</a></dd><div class="fixed"></div></dl>
		<?php } ?>
	</div>
	<li><h3>附件上传</h3></li>
	<li><iframe frameborder=0 width=650 height=40 scrolling=no src="inc/upload.php?action=attach&artid=<?=$artid?>"></iframe></li>
	</ul>
	</div></form>
	<? } ?>
	<? if ($a == 'pagelist'){?>
	<table class="tb" cellspacing="0">
	<form name=form1 action="admin.php?m=page&a=operator" method=post><input name="action" type="hidden" id="action" value="">
	<tr class="title"><td>标题</td><td>作者</td><td>自定义链接</td><td>发布日期</td></tr>
	<? if(!$artdb) { ?>
	<tr><td colspan="6">您还没有发布单页！</td></tr>
	<? } else {
	 foreach($artdb as $art){
	$thisbg = isset($thisbg) && $thisbg == 'content' ? 'content2' : 'content';
?>
	<tr class="<?=$thisbg?>"><td><input class="checkbox" type="checkbox" name="artid[<?=$art['artid']?>]" value="1" />&nbsp;<a href=admin.php?m=page&a=pageedit&artid=<?=$art['artid']?>><?=$art['title']?></a></td>
	<td><?=$art['username']?></td><td><?=$art['htmlurl']?></td><td><?=$art['updatetime']?></td>
	</tr>
	<? } }?>
	<tr class="tb_bottom"><td colspan="6"><input class="checkbox" type="checkbox" name="chkall" value="全选" onClick="javascript:checkAll(this.form)" />&nbsp;全选 管理选项：<a href="#" onClick="{if(confirm('确定删除选定的单页吗?')){document.form1.action.value='delete';this.document.form1.submit();return true;}return false;}">删除选中</a></td></tr></form>
</table>
<table class="tb2" cellspacing="0">
<tr><td><div id="pageview">
  <?=$page?>
</div></td></tr>
</table>
	<? } ?>
	</div>
	<div class="fixed"></div>
</div>
<?
require 'footer.php';
?>